                    _______     __     _______       _______
                   /  ___  \   |  |   /  ___  \     /  ___  \
                  /  /   \__\  |  |  /  /   \__\   /  /   \  \
                 |  |    ____  |  | |  |    ____  |  |     |  |
                 |  |   |_   | |  | |  |   |_   | |  |     |  |
                  \  \___/  /  |  |  \  \___/  /   \  \___/  /
                   \_______/   |__|   \_______/     \_______/

                              Talk to Max Headroom

This month's lengthy listing is a bit different from anything we've ever
printed before. It's unusual, witty and it has no practical use whatsoever.
(Okay, so that last bit sounds a lot like most of the listings we print.)
    The program's called GIGO, which stands for that well-known computer
saying, 'Garbage In, Garbage Out'. The name's very apt, though you may have to
use the program for a while to see why.
    Author is 15-year-old John Ablett, an O-level pupil at Horbury school,
Wakefield, West Yorkshire. 'This program has already proved to be extremely
popular with the computer-studies group at school,' he writes.
    The idea of GIGO is to let you hold a conversation with a little Max
Headroom character at the top of the screen. Max moves his lips as a message
prints up on the screen. You then type in your reply, Max mouths his reply to
your reply, and so on for as long as you're typing finger(s) can stand.
    Max, being a computer-generated character, has a limited vocabulary. He
only knows 102 different things to say including his standard start-up
greeting, 'Hi! What do you want to talk about today?' However, this doesn't
mean that he has to repeat himself. He'll learn your replies, and then throw
them back at you when you least expect them.
    Max isn't a very intelligent guy, I'm afraid, so the things he says don't
always make much sense. The surprising thing is how often they do make sense,
given that he just churns his phrases out at random. He can be very witty
indeed, but this usually depends on the person he's talking to. Bear in mind,
for the most part he's only repeating things you've typed in - so don't insult
him or he'll soon start being rude to you in return.

THE PROGRAM
The central idea of the listing is ingeniously simple. The various comments Max
knows are stored in the array r$(), and line 90 selects from them at random.
When the chosen witticism is printed it's replaced in the array by the comment
you've just entered. This means Max forgets each comment as soon as he says it,
so he can't repeat himself unless you do. This replacement system is very
simple to implement - line 90 does all the work here.
    Although you do occasionally get your comments thrown back at you almost
straightaway, you can find that Max still has some of his original phrases left
after half an hour's conversation.

TAKING THINGS FURTHER
One obvious development you could make yourself would be to get Max talking
through some form of speech synthesiser. I've half a mind to try that myself
with Superior Software's Speech! if I can find the time. The relevant routine
runs from line 330 onwards, and at present it just moves Max's lips. With a bit
of work, you should be able to synchronise lips, printed text and the speech
itself.
    Other interesting projects might involve producing hard copy on a printer,
or creating a 'save comments' feature so that you can store Max's array of
phrases and continue your conversation with him some other time.
    What I'd really like to see is a GIGO-like program that actually reacts to
the things you say. It doesn't have to be very clever about this: the classic
program of this type, ELIZA, simply watches out for particular key words and
responds to them. You'll undoubtedly need a much more complex program, but the
results can be very rewarding indeed. If you come up with anything good, by all
means send it in - we're always happy to have a chat with a reader's program!

 ______________________
|                      |
| [Listing - GIGO.BAS] |
|______________________|
